package com.sunny.ynhz.ui.patrol.problems;

import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.IdRes;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;

import com.amap.api.location.AMapLocation;
import com.amap.api.location.AMapLocationClient;
import com.amap.api.services.core.PoiItem;
import com.amap.api.services.geocoder.GeocodeResult;
import com.amap.api.services.geocoder.GeocodeSearch;
import com.amap.api.services.geocoder.RegeocodeResult;
import com.foamtrace.photopicker.PhotoPickerActivity;
import com.foamtrace.photopicker.SelectModel;
import com.foamtrace.photopicker.intent.PhotoPickerIntent;
import com.sunny.ynhz.adapter.ImageAdapter;
import com.sunny.ynhz.R;
import com.sunny.ynhz.api.ApiService;
import com.sunny.ynhz.api.HttpManager;
import com.sunny.ynhz.api.subscriber.ApiSubscriber;
import com.sunny.ynhz.api.upload.DefaultProgressListener;
import com.sunny.ynhz.api.upload.RetrofitUtil;
import com.sunny.ynhz.api.upload.UploadFileRequestBody;
import com.sunny.ynhz.app.GlobalVal;
import com.sunny.ynhz.bean.ProBean;
import com.sunny.ynhz.bean.ProblemTypeDataBean;
import com.sunny.ynhz.bean.ResultImageBean;
import com.sunny.ynhz.bean.UploadProblemBean;
import com.sunny.ynhz.db.RealmUtils;
import com.sunny.ynhz.model.IProblemTypeResultView;
import com.sunny.ynhz.model.ProblemTypeModel;
import com.sunny.ynhz.ui.report.ChooseAreaActivity;
import com.sunny.ynhz.ui.report.ChooseRiverActivityNative;
import com.sunny.ynhz.ui.MainActivity;
import com.sunny.ynhz.ui.base.AppBaseTranslationTitleBarActivity;
import com.sunny.ynhz.ui.report.ChooseSubmitForObjectActivityNative;
import com.sunny.ynhz.utils.AppManager;
import com.sunny.ynhz.utils.DensityUtil;
import com.sunny.ynhz.utils.GridSpacingItemDecoration;
import com.sunny.ynhz.utils.PictureUtil;
import com.sunny.ynhz.utils.SPUtil;
import com.sunny.ynhz.utils.ShowUtils;
import com.sunny.ynhz.utils.TimeFormatUtils;
import com.sunny.ynhz.utils.TypeAndStatusUtil;
import com.sunny.ynhz.widget.AddProblemTypeDialog;
import com.sunny.ynhz.widget.FlowRadioGroup;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import io.realm.Realm;
import okhttp3.RequestBody;
import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by luao on 2017/5/22.
 */

public class OtherProblemReportActivity extends AppBaseTranslationTitleBarActivity implements GeocodeSearch.OnGeocodeSearchListener, RadioGroup.OnCheckedChangeListener, CompoundButton.OnCheckedChangeListener, IProblemTypeResultView<ProblemTypeDataBean> {
    @BindView(R.id.problem_detail)
    EditText problemDetail;
    @BindView(R.id.problem_type)
    EditText problemType;
    @BindView(R.id.camera)
    ImageView camera;
    @BindView(R.id.imagesRecyleView)
    RecyclerView imagesRecylerView;
    @BindView(R.id.problem_type_radiogroup)
    FlowRadioGroup problemTypeRadiogroup;
    @BindView(R.id.isNativeBox)
    CheckBox isNativeBox;
    @BindView(R.id.choose_report_obj)
    TextView chooseReportObj;
    @BindView(R.id.scroll)
    ScrollView scroll;
    @BindView(R.id.patrol_problem_upload)
    TextView patrolProblemUpload;
    @BindView(R.id.problem_save_draft)
    TextView problemSaveDraft;
    @BindView(R.id.cancel)
    TextView cancel;
    @BindView(R.id.btns)
    LinearLayout btns;
    @BindView(R.id.choose_river)
    TextView chooseRiver;
    @BindView(R.id.lttd)
    TextView lttd;
    @BindView(R.id.lgtd)
    TextView lgtd;
    @BindView(R.id.choose_area)
    TextView tv_choose_area;


    private GeocodeSearch geocoderSearch;

    @BindView(R.id.location_address)
    TextView location_address;
    /**
     * 客户端
     */
    private AMapLocationClient mlocationClient;
    /**
     *
     */
    private Intent intent;
    private int keyValue = 0;
    private OtherProblemReportActivity activity;
    private ArrayList<String> imagesPath = new ArrayList<>();
    private ImageAdapter imageAdapter;
    private String tempImagePathString = "";
    private AddProblemTypeDialog dialog;
    private AMapLocation location;
    private ProBean problemBean;
    private String addvcd = "";
    private String patrolId = "";
    private ArrayList<String> stringArrayListExtra;
    private String officeAdmin = "";
    //河段id
    private String riverId = "";
    //河涌id
    private String reachId = "";
    private String officeAdminName;
    private String riverName;
    private ProblemTypeModel problemTypeModel;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_add_problem);
        ButterKnife.bind(this);
        activity = this;
        setTitle("添加问题");
//        setRightTextView("巡河指南", "#FF0000");
        //
        problemBean = new ProBean();
        intent = getIntent();
        riverId = intent.getStringExtra("riverId");
        reachId = intent.getStringExtra("selectId");
        riverName = intent.getStringExtra("riverName");
        problemBean.setPatrolid(intent.getStringExtra("patrolId"));
        initList();
        location = GlobalVal.getaMapLocation();
        if (location != null) {
            addvcd = location.getAdCode();
//            problemBean.setAddvcd(location.getAdCode());
            location_address.setText(location.getAddress());
            problemBean.setLttd(location.getLatitude());
            lttd.setText("" + location.getLatitude());
            problemBean.setLgtd(location.getLongitude());
            lgtd.setText("" + location.getLongitude());
        }
        problemTypeModel = new ProblemTypeModel(this, this);
        problemTypeModel.getProblemTypeData();
        if (!TextUtils.isEmpty(riverName)) {
            chooseRiver.setText(riverName);
        }
    }

    private void addListener() {
        isNativeBox.setOnCheckedChangeListener(this);
        geocoderSearch = new GeocodeSearch(this);
        geocoderSearch.setOnGeocodeSearchListener(this);
        problemTypeRadiogroup.setOnCheckedChangeListener(this);
    }

    private void initList() {
        imagesRecylerView.setLayoutManager(new GridLayoutManager(this, 3));
        imagesRecylerView.addItemDecoration(new GridSpacingItemDecoration(3, 20, false));
        imagesRecylerView.setItemAnimator(new DefaultItemAnimator());

        imageAdapter = new ImageAdapter(this, imagesPath);
        imagesRecylerView.setAdapter(imageAdapter);
    }

    /**
     * 初始化radiobtns
     */
    private void setRadioBtns() {
        //problemType
        for (Map.Entry<String, String> entry : TypeAndStatusUtil.getProblemTpye().entrySet()) {
            addRadioBtn(problemTypeRadiogroup, entry.getValue());
        }
    }

    @Override
    public void clickRightTextView() {
        super.clickRightTextView();
        doAcitivity(InspectionContentActivity.class);
    }

    /**
     * 动态 添加radiobtn
     *
     * @param radioGroup 需要加入的radiogroup
     * @param str        radiobtn.text
     */
    private void addRadioBtn(RadioGroup radioGroup, String str) {
        int marginRight = DensityUtil.dip2px(this, 8);
        int marginBottom = DensityUtil.dip2px(this, 5);
        LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        //第一个参数为xml文件中view的id，第二个参数为此view的父组件，可以为null，android会自动寻找它是否拥有父组件
        RadioButton tempButton = (RadioButton) inflater.inflate(R.layout.radiobtn, null);
        tempButton.setText(str);
        radioGroup.addView(tempButton);
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        params.setMargins(0, 0, marginRight, marginBottom);
        tempButton.setLayoutParams(params);
    }

    private void setProblemData() {
        problemBean.setUserId(SPUtil.get("userId", "null").toString());
        String time = TimeFormatUtils.timeStamp2Date(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss");
        problemBean.setTime(time);
        problemBean.setDescribe(problemDetail.getText().toString());
        problemBean.setState("");
        problemBean.setPosition(location_address.getText().toString());
        if (location != null) {
            problemBean.setLttd(location.getLatitude());
            problemBean.setLgtd(location.getLongitude());
        }

        problemBean.setCuurUserId(officeAdmin);
        problemBean.setCuurName(officeAdminName);
        problemBean.setSectionId(riverId);
        problemBean.setReachId(reachId);
        problemBean.setSectionName(riverName);
        problemBean.setAddvcd(tv_choose_area.getTag().toString());
        // 拼接图片路径
        int imageCount = imagesPath.size();
        if (imageCount > 0) {
            String imagePicPath = "";
            for (int i = 0; i < imageCount; i++) {
                imagePicPath = imagePicPath + imagesPath.get(i) + ";";
            }
            problemBean.setPicture(imagePicPath);
        }


    }

    private void dialogConfirmReportProblem() {
        if (problemDetail.getText().toString().equals("")) {
            Toast.makeText(activity, "请输入问题内容", Toast.LENGTH_SHORT).show();
            return;
        } else if (tv_choose_area.getTag() == null || TextUtils.isEmpty(tv_choose_area.getTag().toString())) {
            Toast.makeText(activity, "请选择行政区域", Toast.LENGTH_SHORT).show();
            return;
        } else if (problemType.getText().toString().equals("")) {
            Toast.makeText(activity, "请选择问题类型", Toast.LENGTH_SHORT).show();
            return;
        } else if (TextUtils.isEmpty(reachId) && TextUtils.isEmpty(riverId)) {
            Toast.makeText(this, "请选择河道", Toast.LENGTH_SHORT).show();
            return;
        } else if (officeAdmin.equals("") && chooseReportObj.isClickable()) {
            Toast.makeText(this, "请选择提交对象", Toast.LENGTH_SHORT).show();
            return;
        } else if (location_address.getText().toString().equals("")) {
            Toast.makeText(this, "定位失败，请手动选择地理位置", Toast.LENGTH_LONG).show();
            return;
        } else if (imagesPath.size() == 0) {
            Toast.makeText(this, "请至少上传一张图片", Toast.LENGTH_LONG).show();
            return;
        }

        new AlertDialog.Builder(activity)
                .setTitle("是否提交问题")
                .setMessage("是否提交问题")
                .setPositiveButton("是", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        //提交问题
                        uploadProblem();
                    }
                })
                .setNegativeButton("否", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        //不操作
                    }
                })
                .show();

    }

    /**
     * 上传问题
     */
    public void uploadProblem() {
        setProblemData();
        if (imagesPath.size() == 0) {
            uploadProblemToHttp();
        } else {
            final Handler mHandler2 = new Handler() {
                public void handleMessage(Message msg) {
//                    Toast.makeText(activity, msg.obj.toString(), Toast.LENGTH_LONG).show();
                    ArrayList<String> filePath = (ArrayList<String>) msg.obj;
                    ArrayList<String> clonearr = (ArrayList<String>) filePath.clone();
                    uploadFile(clonearr);
                    loadOnAfter();
                    super.handleMessage(msg);
                }
            };

            Thread thread = new Thread(new Runnable() {
                @Override
                public void run() {
                    ArrayList<String> arrayList = new ArrayList<>();
                    loadOutStart();
                    for (int i = 0; i < imagesPath.size(); i++) {
                        Bitmap bitmap = PictureUtil.getSmallBitmap(imagesPath.get(i));
                        SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
                        Date date = new Date(System.currentTimeMillis());
                        String filename = format.format(date);
                        File file = PictureUtil.compressImage(bitmap, filename + i);
                        arrayList.add(file.getPath());
                    }

                    // TODO Auto-generated method stub
                    Message message = new Message();
                    message.obj = arrayList;
                    mHandler2.sendMessage(message);
                }
            });
            thread.start();
        }
    }

    private void saveProblem() {
        if (problemDetail.getText().toString().equals("")) {
            Toast.makeText(this, "请输入问题内容", Toast.LENGTH_SHORT).show();
            return;
        } else if (problemType.getText().toString().equals("")) {
            Toast.makeText(this, "请选择问题类型", Toast.LENGTH_SHORT).show();
            return;
        } else if (imagesPath.size() == 0) {
            Toast.makeText(this, "请至少上传一张图片", Toast.LENGTH_LONG).show();
            return;
        } else if (tv_choose_area.getTag() == null || TextUtils.isEmpty(tv_choose_area.getTag().toString())) {
            Toast.makeText(activity, "请选择行政区域", Toast.LENGTH_SHORT).show();
            return;
        }

        setProblemData();

        if (isNativeBox.isChecked()) {
            problemBean.setNativeprocessing("1");
            officeAdmin = null;
        } else {
            problemBean.setNativeprocessing("0");
        }

        problemBean.setId(UUID.randomUUID().toString());
        RealmUtils.getDeleteRealm().executeTransactionAsync(new Realm.Transaction() {
            @Override
            public void execute(Realm realm) {
                realm.copyToRealm(problemBean);
            }
        });

        finish();
    }

    /**
     * 上报问题
     */
    private void uploadProblemToHttp() {
        // TODO: 2017/7/23 引入了是否本机解决
        if (isNativeBox.isChecked()) {
            problemBean.setNativeprocessing("1");
        } else {
            problemBean.setNativeprocessing("0");
        }
        boolean isPatroling = getIntent().getBooleanExtra("isPatroling", false);
        if (isPatroling) {
            problemBean.setIspatrol("1");
        } else {
            problemBean.setIspatrol("2");
        }
        HttpManager.getInstance().uploadProblem(problemBean.getType(), problemBean.getTime(), SPUtil.get("userId", "null").toString(), problemBean.getNativeprocessing(),
                problemBean.getLttd(), problemBean.getLgtd(), location_address.getText().toString(),
                problemDetail.getText().toString(), tv_choose_area.getTag().toString(), getIntent().getStringExtra("patrolId"), tempImagePathString, null, "0",
                problemBean.getIspatrol(), officeAdmin, riverId, reachId)
                .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
                .subscribe(new ApiSubscriber(this, new ApiSubscriber.HttpOnResultListener<UploadProblemBean>() {
                    @Override
                    public void onNext(UploadProblemBean jsonObject) {
                        MainActivity activity = (MainActivity) AppManager.getInstance().getActivity(MainActivity.class);
                        activity.updateNumMsg();
                        finish();
                    }

                    @Override
                    public void onCompleted() {

                    }

                    @Override
                    public void onstart() {
                    }

                    @Override
                    public void onError(Throwable e) {
                        super.onError(e);
                    }
                }));
    }

    private Handler mHandler = new Handler() {
        /**
         * what是文件上传百分比
         *
         * @param msg
         */
        @Override
        public void handleMessage(Message msg) {
            switch (msg.arg1) {
                case 1:
                    if (msg.what > 0) {

                    }
                    break;
            }
        }
    };

    /**
     * 文件上传，一个接一个
     *
     * @param filePath 文件路径数组
     */
    public void uploadFile(List<String> filePath) {
        File cutFile = null;
        if (filePath.size() > 0) {
            cutFile = new File(filePath.get(0));
        }

        if (cutFile != null) {
            ApiService uploadFileService = RetrofitUtil.createService(ApiService.class);
            Map<String, String> optionMap = new HashMap<>();
            optionMap.put("name", cutFile.getName());
            optionMap.put("path", "path");

            Map<String, RequestBody> requestBodyMap = new HashMap<>();
            UploadFileRequestBody fileRequestBody = new UploadFileRequestBody(cutFile, new DefaultProgressListener(mHandler, 1));
            requestBodyMap.put("file\"; filename=\"" + "name.jpg", fileRequestBody);


            final List<String> finalFilePath = filePath;
            uploadFileService.uploadFileInfo(optionMap, requestBodyMap).
                    subscribeOn(Schedulers.io()).
                    observeOn(AndroidSchedulers.mainThread()).
                    subscribe(new Subscriber<ResultImageBean>() {
                        @Override
                        public void onStart() {
                            super.onStart();
                            ShowUtils.inItPopwin(activity, "正在上传图片");
                        }

                        @Override
                        public void onCompleted() {
                            loadOnAfter();
                        }

                        @Override
                        public void onError(Throwable e) {
                            loadOnAfter();

                        }

                        @Override
                        public void onNext(ResultImageBean s) {
                            tempImagePathString = tempImagePathString + s.getNewPath() + ";";
                            finalFilePath.remove(0);
                            if (finalFilePath.size() == 0) {
                                uploadProblemToHttp();
                            } else {
                                uploadFile(finalFilePath);
                            }

                            loadOnAfter();
                        }
                    });
        }
    }


    @Override
    public void onRegeocodeSearched(RegeocodeResult regeocodeResult, int i) {
        if (keyValue == 0) {
            location_address.setText("地点：" + regeocodeResult.getRegeocodeAddress().getFormatAddress());
        }

        intent.putExtra("location_poi", regeocodeResult.getRegeocodeAddress().getFormatAddress());
        ArrayList<PoiItem> poiList = new ArrayList<>();
        poiList = (ArrayList<PoiItem>) regeocodeResult.getRegeocodeAddress().getPois();
        intent.putParcelableArrayListExtra("listObj", poiList);

    }

    @Override
    public void onGeocodeSearched(GeocodeResult geocodeResult, int i) {

    }

    /**
     * 点击事件
     */
    @OnClick({R.id.choose_area, R.id.location_address, R.id.camera, R.id.patrol_problem_upload, R.id.problem_save_draft, R.id.cancel, R.id.choose_report_obj, R.id.choose_river})
    public void onclick(View view) {
        if (view.getId() == R.id.location_address) {
            Intent intent = new Intent(this, PositionMapSelectActivity.class);
            intent.putExtra("position", problemBean.getPosition());
            intent.putExtra("lttd", problemBean.getLttd());
            intent.putExtra("lgtd", problemBean.getLgtd());
            startActivityForResult(intent, 200);
        } else if (view.getId() == R.id.camera) {
            PhotoPickerIntent intent = new PhotoPickerIntent(OtherProblemReportActivity.this);
            intent.setSelectModel(SelectModel.MULTI);
            intent.setShowCarema(true); // 是否显示拍照， 默认false
            intent.setMaxTotal(9); // 最多选择照片数量，默认为9
            intent.setSelectedPaths(imagesPath); // 已选中的照片地址， 用于回显选中状态
            startActivityForResult(intent, 0);
        } else if (view.getId() == R.id.patrol_problem_upload) {
            dialogConfirmReportProblem();
        } else if (view.getId() == R.id.problem_save_draft) {
            saveProblem();
        } else if (view.getId() == R.id.cancel) {
            finish();
        } else if (view.getId() == R.id.choose_report_obj) {
            Intent intent = new Intent(this, ChooseSubmitForObjectActivityNative.class);
            startActivityForResult(intent, 500);
        } else if (view.getId() == R.id.choose_river) {
            Intent intent = new Intent(this, ChooseRiverActivityNative.class);
            startActivityForResult(intent, 600);
        } else if (view.getId() == R.id.choose_area) {
            Intent intent = new Intent(this, ChooseAreaActivity.class);
            startActivityForResult(intent, 700);
        }
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == 0 && data != null) {
            stringArrayListExtra = data.getStringArrayListExtra(PhotoPickerActivity.EXTRA_RESULT);
            if (stringArrayListExtra != null) {
                imagesPath.clear();
                imagesPath.addAll(stringArrayListExtra);
                imageAdapter.notifyDataSetChanged();
            }
        } else if (resultCode == 200) {
            problemBean.setLttd(data.getDoubleExtra("lttd", 0.0));
            problemBean.setLgtd(data.getDoubleExtra("lgtd", 0.0));
            problemBean.setPosition(data.getStringExtra("position"));
//            problemBean.setAddvcd(data.getStringExtra("addvcd"));
            lttd.setText("" + problemBean.getLttd());
            lgtd.setText("" + problemBean.getLgtd());
            location_address.setText(problemBean.getPosition());
        } else if (resultCode == 300) {
            chooseReportObj.setText(data.getStringExtra("reportObj"));
            officeAdmin = data.getStringExtra("officeAdmin");
        } else if (resultCode == 400) {
            chooseRiver.setText(data.getStringExtra("riverNmae"));
            riverId = data.getStringExtra("riverId");
        } else if (resultCode == 500) {
            officeAdmin = data.getStringExtra("id");
            officeAdminName = data.getStringExtra("name");
            chooseReportObj.setText(data.getStringExtra("name"));

        } else if (resultCode == 600) {

            chooseRiver.setText(data.getStringExtra("name"));
            riverName = data.getStringExtra("name");
            riverId = data.getStringExtra("id");//河段id
            reachId = data.getStringExtra("reachId");//河涌id
        } else if (requestCode == 700) {
            if (data != null) {
                String areaCode = data.getStringExtra("areaCode");
                String areaName = data.getStringExtra("areaName");
                tv_choose_area.setText(areaName);
                tv_choose_area.setTag(areaCode);
                problemBean.setAddvcd(areaCode);
            }

        }

    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
        // TODO: 2017/10/14 可能有内存泄露
//        mHandler.removeCallbacks();
    }

    /**
     * 标签选中监听
     *
     * @param group
     * @param checkedId
     */
    @Override
    public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) {
        if (group.equals((RadioGroup) problemTypeRadiogroup)) {
            problemType.setText(problemTypeRadiogroup.getCheckedRadioButtonText());
            problemBean.setType(TypeAndStatusUtil.getProblemValueByTable(problemTypeRadiogroup.getCheckedRadioButtonText()));
        }
    }

    @Override
    public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
        if (compoundButton.equals(isNativeBox)) {
            if (b) {
                //本级处理
                chooseReportObj.setClickable(false);
                chooseReportObj.setTextColor(Color.GRAY);
            } else {
                //不是本级处理
                chooseReportObj.setClickable(true);
                chooseReportObj.setTextColor(Color.BLACK);

            }
        }

    }

    @Override
    public void onSuccess(ProblemTypeDataBean problemTypeDataBean) {
        setRadioBtns();
        addListener();
        loadSuccess();
    }

    @Override
    public void onCache() {
        setRadioBtns();
        addListener();
        loadSuccess();

    }

    @Override
    public void onFail() {
        loadFail();
    }

    @Override
    public void onStartLoad() {
        startLoad();

    }

    @Override
    public void resLoad() {
        super.resLoad();
        problemTypeModel.getProblemTypeData();

    }
}
